﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ShippingDetails : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        lblOrderID.Text = Application["OrderID"].ToString();
        lblProductID.Text = Application["ProductID"].ToString();
        double price = Convert.ToDouble(Application["Price"]);
        int quantity = Convert.ToInt32(Application["Quantity"]);
        double amount = price * quantity;
        lblGrossLineTotal.Text = amount.ToString();
        lblDiscount.Text = "0";
        if(Application["Discount"] != null){
            double discount = amount * (Convert.ToInt32(Application["Discount"]))/100;
            lblDiscount.Text = discount.ToString("#####.##");
        }
        lblTaxes.Text = (amount * (12.50/100)).ToString("#####.##");
        double totalAmount = Convert.ToDouble(lblGrossLineTotal.Text) + Convert.ToDouble(lblTaxes.Text) - Convert.ToDouble(lblDiscount.Text) ;
        lblAmount.Text = totalAmount.ToString("#####.##");
        txtZipCode.Focus();
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Application["Delivery"] = "0";
        if(ddlLocation.SelectedIndex == 1){
            Application["Delivery"] = "15";
        }else if(ddlLocation.SelectedIndex == 2){
            Application["Delivery"] = "25";
        }
        Application["Amount"] = lblAmount.Text;
        Response.Redirect("Notification.aspx");
    }
    protected void btnReset_Click(object sender, EventArgs e)
    {
        txtZipCode.Text = "";
        ddlLocation.SelectedIndex = 0;
        txtZipCode.Focus();
    }
}